# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=srt
pkgver=1.4.3
pkgrel=1
pkgdesc="Secure Reliable Transport library"
url="https://www.srtalliance.org/"
arch=(x86_64)
license=(MPL2)
depends=(openssl)
makedepends=(git cmake)
_commit=291e010fbf91b13b92e1cde5dcb824a9d7f4e353  # tags/v1.4.3
source=("git+https://github.com/Haivision/srt#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  cmake -S srt -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_BINDIR=bin \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_INSTALL_INCLUDEDIR=include \
    -DCMAKE_BUILD_TYPE=None \
    -DENABLE_STATIC=ON \
    -DENABLE_TESTING=ON
  cmake --build build
}

check() {
  cd build
  ./uriparser-test
  ./utility-test
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  rm "$pkgdir"/usr/bin/{uriparser,utility}-test
}

# vim:set ts=2 sw=2:
